package com.fau.wmbj.server.utils;

import java.io.File;
import java.io.IOException;

/**
 * 常量
 *
 * @author jiawei
 * @version 1.0
 * @datetime 2023-03-08 16:42
 */
public class Constants {

    public static String REALPATH;

    static {
        try {
            REALPATH = new File(Constants.class.getResource("/").getPath()).getParentFile().getParentFile().getCanonicalPath();
        } catch (IOException exception) {
            exception.printStackTrace();
        }
    }

    /**
     * "验证码"缓存名称
     */
    public static final String SMS_CAPTCHA_CACHE_NAME = "SMS_CAPTCHA";
    public static final String FAILED_LOGIN_ATTEMPTS_CACHE_NAME = "FAILED_LOGIN_ATTEMPTS";
    public static final String TREE_PATH_SEPARATOR = ",";
    public static final String SETTING_CACHE_KEY = "SETTING";
    /**
     * "验证码"缓存名称
     */
    public static final String CAPTCHA_CACHE_NAME = "CAPTCHA";
    public static final String USER_ORDER_COUNT_CACHE_NAME = "CACHE_USER_ORDER_COUNT";

    /**
     * 默认"当前用户"属性名称
     */
    public static final String DEFAULT_CURRENT_USER_ATTRIBUTE_NAME = "currentUser";

    public static final String CONFIG_COOKIE_PATH = "/";
    public static final String CONFIG_COOKIE_DOMAIN = "";

    public static final String ORDER_EXPIRE_KEY = "ORDER_EXPIRE_KEY";
    public static final String UPLOAD_EXPIRE_KEY = "UPLOAD_EXPIRE_KEY";

    public static final String CODE_REQUEST_URL = "https://open.weixin.qq.com/connect/oauth2/authorize#wechat_redirect";
    /**
     * 查询订单请求URL
     */
    public static final String ORDER_QUERY_REQUEST_URL = "https://api.mch.weixin.qq.com/pay/orderquery";
    /**
     * prepay_id请求URL
     */
    public static final String PREPAY_ID_REQUEST_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
    /**
     * openId请求URL
     */
    public static final String OPEN_ID_REQUEST_URL = "https://api.weixin.qq.com/sns/oauth2/access_token";
    public static final String[] DATE_PATTERNS = new String[]{
            "yyyy",
            "yyyy-MM",
            "yyyyMM",
            "yyyy/MM",
            "yyyy-MM-dd",
            "yyyyMMdd",
            "yyyy/MM/dd",
            "yyyy-MM-dd HH:mm:ss",
            "yyyyMMddHHmmss",
            "yyyy/MM/dd HH:mm:ss",
            "MM月dd日",
            "yyyy-MM-dd HH:mm"};

    /**
     * 用户身份
     */
    public enum UserType {
        admin, dependents
    }

    public enum AuthenticationType {
        jwt, session
    }

    /**
     * 登录类型
     */
    public enum LoginType {

        /**
         * 密码登录
         */
        pwd,

        /**
         * 短信登录
         */
        sms,
    }

    public enum MenuType {
        menu, button, other
    }

    /**
     * 性别
     */
    public enum Gender {

        /**
         * 男
         */
        male,

        /**
         * 女
         */
        female
    }

    /**
     * 罪犯状态
     */
    public enum CriminalStatus {

        /**
         * 在监
         */
        in,

        /**
         * 释放
         */
        release
    }

    /**
     * 亲属关系类型
     */
    public enum RelationType {
        /**
         * 配偶
         */
        spouse,

        /**
         * 父母
         */
        parent,

        /**
         * 子女
         */
        children,

        /**
         * 兄弟姐妹
         */
        brother,

        /**
         * 其他
         */
        other,
    }

    /**
     * 小数位精确方式
     */
    public enum RoundType {

        /**
         * 四舍五入
         */
        roundHalfUp,

        /**
         * 向上取整
         */
        roundUp,

        /**
         * 向下取整
         */
        roundDown
    }

    /**
     * 类型
     */
    public enum DepositLogType {

        /**
         * 存款
         */
        deposits,

        /**
         * 调整
         */
        adjustment,

        /**
         * 退款
         */
        refunds,

        /**
         * 提现
         */
        cash
    }

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";
}
